<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
		<title>我的</title>
		<link href="../../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="../../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">
		<link href="../../css/personal.css" rel="stylesheet" type="text/css">
		<link href="../../css/colstyle.css" rel="stylesheet" type="text/css">
		<script src="../../AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="../../AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
		<script type="text/javascript" src="../../js/common.js"></script>
	</head>

	<body>
		<!--头 -->
		<header>
			<article>
				<div class="mt-logo">
					<!--顶部导航条 -->
					<div class="am-container header">
						<ul class="message-l">
							<div class="topMessage">
								<div class="menu-hd" id="indexHeader">
								</div>
							</div>
						</ul>
						</div>
					</div>
				</div>
			</article>
		</header>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">
					<div class="user-collection">
						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">我正在出售</strong></div>
						</div>
						<hr/>
						<div class="you-like">
							<div class="s-content"></div>
						</div>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person active">
						<a href="index.html">个人中心</a>
					</li>
					<li class="person">
						<a href="#">个人资料</a>
						<ul>
							<li>
								<a href="information.html">信息管理</a>
							</li>
						</ul>
					</li>
					<li class="person">
						<a href="#">我的交易</a>
						<ul>
							<li>
								<a href="order.html">买入订单</a>
							</li>
							<li>
								<a href="sellorder.html">卖出订单</a>
							</li>
						</ul>
					</li>
					<li class="person">
						<a href="#">我的资产</a>
						<ul>
							<li>
								<a href="collection.html">正在出售</a>
							</li>
							<li>
								<a href="upload.html">上传商品</a>
							</li>
						</ul>
					</li>
				</ul>
			</aside>
		</div>
		
		
		<script>
			$(function(){
				/*检验用户是否登录*/
				if (getCookie("username") == null || getCookie("userid") == null) {
                    window.location.href="../login.html";
                    return;
			    }else{
			    	$("#indexHeader").append(`
                            <a href="#" target="_top" class="h">您好，${getCookie("username")}</a>
                            <a href="javascript:void(0);" onclick="clearCookie()">退出</a>`
                    );
			    }
			    
			    /**
			     * 查询我正在出售的
			     */
			    var userid=getCookie("userid");
			    $.ajax({
			    	type:"get",
			    	url:"/goods/selectByUserid/"+userid,
			    	async:true,
			    	success:function(data){
			    		for(var i=0;i<data.length;i++){
			    			var html=`
								<div class="s-item-wrap">
									<div class="s-item">
										<div class="s-pic">
											<a href="#" class="s-pic-link">
												<img src="${data[i].img1}" class="s-pic-img s-guess-item-img">
											</a>
										</div>
										<div class="s-info">
											<div class="s-title"><a href="#" title="">${data[i].goodsname}</a></div>
											<div class="s-price-box">
												<span class="s-price">
													<em class="s-price-sign">¥</em>
													<em class="s-value">${data[i].price}</em>
												</span>
											</div>
										</div>
									</div>
								</div>`;
							$(".s-content").append(html);
			    		}
			    		
			    	}
			    });
			})
			
		</script>
	</body>

</html>